package J5_12;

import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class test {
    public static void main1(String[] args) {
        Scanner in = new Scanner(System.in);
        char[] ch = in.next().toCharArray();
        Map<Character, Integer> map = new HashMap<>();
        int max = 0, min = ch.length;
        for (int i = 0; i < ch.length; i++) {
            map.put(ch[i], map.getOrDefault(ch[i], 0) + 1);
        }
        for (Map.Entry<Character, Integer> entry : map.entrySet()) {
            max = Math.max(max , entry.getValue());
            min = Math.min(min , entry.getValue());
        }
        int a = max - min;
        if (isPri(a)) {
            System.out.println("Lucky Word");
            System.out.println(a);
        } else {
            System.out.println("No Answer");
            System.out.println(0);
        }
    }

    private static boolean isPri(int a) {
        if (a < 2) {
            return false;
        }
        for (int i = 2; i <= Math.sqrt(a); i++) {
            if (a % i == 0) {
                return false;
            }
        }
        return true;
    }

    public static boolean hostschedule (int[][] schedule) {
        Arrays.sort(schedule, (a, b) -> a[0] - b[0]);
        int l = schedule[0][0], r = schedule[0][1];
        for (int i = 1; i < schedule.length; i++) {
            if (schedule[i][l] < r) {
                return false;
            }
            r = schedule[i][1];
        }
        return true;
    }

    public static void main(String[] args) {
        int[][] arr = new int[][]{{0,10}, {15, 30}, {10,20}};
        System.out.println(hostschedule(arr));
    }

    public static void main2(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] arr = new int[n];
        int sum = 0;
        for (int i = 0; i < arr.length; i++) {
            arr[i] = in.nextInt();
            sum += arr[i];
        }
        Arrays.sort(arr);
        if (sum % 2 == 1) {
            System.out.println("false");
            return;
        }
        int target = sum / 2, cur = 0;
        for (int i = 0; i < arr.length; i++) {
            cur += arr[i];
            if (cur == target) {
                System.out.println("true");
                return;
            }
            if (cur > target) {
                System.out.println("false");
                return;
            }
        }
    }
}
